﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Resources;
using System.Globalization;

namespace Besture.Common
{
    public class BaseControl : System.Web.UI.UserControl
    {
        private Resources resource = null;
        private CultureInfo cultureInfo = null;
        public CultureInfo GetCurrentCulture
        {
            get
            {
                if (cultureInfo == null)
                {
                    return new CultureInfo(Session["cultureName"].ToString());
                }
                return cultureInfo;
            }
        }

        public void PrepareResource(Type typeObj)
        {
            resource = new Resources(typeObj, GetCurrentCulture);
        }

        public Resources Resource
        {
            get
            {
                return resource;
            }
        }

        public string GetResource(string key)
        {
            return Resource[key];
        }
    }


}
